home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 2
/
Merciful - Disc 2.iso
/
software
/
m
/
maxonc++3.dms
/
maxonc++3.adf
/
DEMOS
/
LibReq.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-23
|
4KB
|
133 lines
#include <exec/types.h>
#include <libraries/dosextens.h>
#include <functions.h>
#include <stdio.h>
#include <clib/rct_protos.h>
APTR RctBase,ApplBase;
void main( void)
{
SHORT handle,quit = 0;
struct TagItem taglist[8];
struct R_ScrModeReq *ScrModes;
struct R_FileRequester *rf;
struct R_FontRequester *rfnt;
struct R_ScrModeReq *smr;
if( ! (RctBase =(APTR)OpenLibrary( ( UBYTE *)"rct.library",16L)))
{
printf("Can't open libraries\n");
return;
}
if( ApplBase = R_InitApplTags( RIA_Version, 1640L, RIA_Debug, 1L, RIA_AutoRenderColor, 1L, TAG_DONE))
{
do
{
taglist[0].ti_Tag = RF_Handle;
taglist[0].ti_Data = 0L;
taglist[1].ti_Tag = RF_FileReqAdr;
taglist[1].ti_Data = 0L;
taglist[2].ti_Tag = RF_InitialWidth;
taglist[2].ti_Data = 600;
taglist[3].ti_Tag = RF_InitialHeight;
taglist[3].ti_Data = 400;
taglist[4].ti_Tag = TAG_DONE;
if( R_Filer( ApplBase, taglist))
{
rf = (struct R_FileRequester *)taglist[1].ti_Data;
printf ("dir: [%s]\nfile: [%s]\nHandle [%ld]\n", rf->fr_Drawer, rf->fr_File,taglist[0].ti_Data);
taglist[0].ti_Tag = RF_FileReqAdr;
taglist[0].ti_Data = ( ULONG)rf;
taglist[1].ti_Tag = TAG_DONE;
if( R_Filer( ApplBase, taglist)) /* der zweite Aufruf mit der gleichen Liste */
printf ("dir: [%s]\nfile: [%s]\n", rf->fr_Drawer, rf->fr_File);
taglist[0].ti_Tag = RF_Handle;
taglist[0].ti_Data = 0L;
taglist[1].ti_Tag = RF_FileReqAdr;
taglist[1].ti_Data = 0L;
taglist[2].ti_Tag = TAG_DONE;
if( R_Filer( ApplBase, taglist)) /* ein ganz neuer FileRequester */
{
rf = (struct R_FileRequester *)taglist[1].ti_Data;
printf ("dir: [%s]\nfile: [%s]\nHandle [%ld]\n", rf->fr_Drawer, rf->fr_File,taglist[0].ti_Data);
}
/* Oder so */
taglist[0].ti_Tag = R_New_Res;
taglist[0].ti_Data = 1L;
taglist[1].ti_Tag = R_RetHandle; /* muß nicht angegeben werden */
taglist[1].ti_Data = 0L;
taglist[2].ti_Tag = TAG_DONE;
if(rf = R_Create( ApplBase, R_FileReq, taglist))
{
taglist[0].ti_Tag = RF_FileReqAdr;
taglist[0].ti_Data = ( ULONG)rf;
taglist[1].ti_Tag = TAG_DONE;
if( R_Filer( ApplBase, taglist)) /* ein ganz neuer FileRequester */
printf ("dir: [%s]\nfile: [%s]\n", rf->fr_Drawer, rf->fr_File,taglist[0].ti_Data);
R_Destroy( ApplBase, rf); /* Struktur wieder freigeben - wird automatisch von R_Exitappl erledigt */
}
taglist[0].ti_Tag = RFO_DoStyle;
taglist[0].ti_Data = FALSE;
taglist[1].ti_Tag = RFO_DoFrontPen;
taglist[1].ti_Data = FALSE;
taglist[2].ti_Tag = RFO_DoBackPen;
taglist[2].ti_Data = FALSE;
taglist[3].ti_Tag = RFO_DoDrawMode;
taglist[3].ti_Data = FALSE;
taglist[4].ti_Tag = TAG_DONE;
if( rfnt = R_FontReq( ApplBase, taglist))
{
printf ("font: [%s]\n", rfnt->fo_Attr.ta_Name);
taglist[0].ti_Tag = RSM_DoWidth;
taglist[0].ti_Data = TRUE;
taglist[1].ti_Tag = RSM_DoHeight;
taglist[1].ti_Data = TRUE;
taglist[2].ti_Tag = RSM_DoDepth;
taglist[2].ti_Data = TRUE;
taglist[3].ti_Tag = RSM_DoAutoScroll;
taglist[3].ti_Data = FALSE;
taglist[4].ti_Tag = RSM_DoOverScanType;
taglist[4].ti_Data = FALSE;
taglist[7].ti_Tag = TAG_DONE;
}
if( smr = R_ModeIDReq( ApplBase, taglist))
{
printf("Mode 0x%lx\n",smr->rs_DisplayID);
printf("Mode 0x%ld\n",smr->rs_DisplayWidth);
printf("Mode 0x%ld\n",smr->rs_DisplayHeight);
}
}
/* hier wird auf die ASL Requester umgeschaltet */
R_InitApplTags( RIA_ChangeFlags, ( ULONG)ApplBase, RIA_AutoRenderColor, 1L, RIA_UseAslFiler, 1L, RIA_UseAslFontReq, 1L, RIA_UseAslScrReq, 1L, TAG_DONE);
quit ^= 1;
} while( quit);
if( R_FormAlertTags( ApplBase, RFA_Center, 1L, RFA_CloseID , 2L, RFA_WindowDrag, 1L, RFA_WindowClose, 1L, RFA_WindowDepth, 1L, RFA_DefaultID, 2, RFA_GadgetText,"_OK|_Zurück",RFA_AlertText, "[2][ |Programm beenden ?]",TAG_DONE) == 1)
quit = -1;
R_ExitAppl( ApplBase);
}
else
printf("vermutlich falsche Library Version\n");
CloseLibrary( ( struct Library *)RctBase);
}
#include <rct/rcttagfuncs.h>